package com.exam.api.modules.exampaper.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.exam.api.modules.exampaper.domain.TblUserAnswerRecord;
import com.exam.api.modules.exampaper.dto.PageQuestionReviewDto;
import com.exam.api.modules.exampaper.mapper.TblUserAnswerRecordMapper;
import com.exam.api.modules.exampaper.service.TblUserAnswerRecordService;
import com.exam.api.modules.exampaper.vo.PageQuestionReviewVO;
import com.exam.api.modules.exampaper.vo.UserReviewAnswerItemVO;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TblUserAnswerRecordServiceImpl extends ServiceImpl<TblUserAnswerRecordMapper, TblUserAnswerRecord> implements TblUserAnswerRecordService {
    @Override
    public IPage<PageQuestionReviewVO> reviewQuestionList(PageQuestionReviewDto dto) {
        return baseMapper.reviewQuestionList(Page.of(dto.getPageNum(), dto.getPageSize()), dto);
    }

    @Override
    public List<UserReviewAnswerItemVO> answerRecordDetail(Long recordId) {
        TblUserAnswerRecord record = getById(recordId);
        return baseMapper.selectUserAnswerList(record.getPaperId(), record.getUserId());
    }
}
